<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<script type="text/javascript">

  $(function() {
    initLoadData('/roleController/detailRole.html',$('#roleIdFrom').text());
    $('#editFunction').click(function () {
      parent.$.messager.progress({
        title: '提示',
        text: '数据处理中，请稍后....'
      });
      var isValid = $('#form').form('validate');
      if (isValid) {
        parent.$.messager.progress('close');
        var postData = $('#form').serializeJson();
        $.ajax({
          url: "${pageContext.request.contextPath}/roleController/updateRole.html",
          type: "post",
          dataType: "json",
          data: postData,
          success: function (result) {
            parent.$.messager.progress('close');
            if (result && isSuccess(result.result)) {
              parent.$.modalDialog.openner_treeGrid.datagrid('getPager').pagination('select');
              parent.$.modalDialog.handler.dialog('close');
              return false;
            }else{
              parent.$.messager.alert('提示', result.result + " " + result.message, 'info');
              return false;
            }
            return false;
          },
          error: function (result) {
//			internalError();
            templateInternalError(result.responseText);
            parent.$.messager.progress('close');
            return false;
          }
        });
      } else {
        parent.$.messager.progress('close');
        return isValid;
      }
    });
    <%--$('#form').form({--%>
      <%--url : '${pageContext.request.contextPath}/roleController/updateRole.html',--%>
      <%--onSubmit : function() {--%>
        <%--parent.$.messager.progress({--%>
          <%--title : '提示',--%>
          <%--text : '数据处理中，请稍后....'--%>
        <%--});--%>
        <%--var isValid = $(this).form('validate');--%>
        <%--if (!isValid) {--%>
          <%--parent.$.messager.progress('close');--%>
        <%--}--%>
        <%--return isValid;--%>
      <%--},--%>
      <%--success : function(result) {--%>
        <%--parent.$.messager.progress('close');--%>
        <%--result = $.parseJSON(result);--%>
        <%--if (result && isSuccess(result.result)) {--%>
          <%--parent.$.modalDialog.openner_treeGrid.datagrid('getPager').pagination('select');--%>
          <%--parent.$.modalDialog.handler.dialog('close');--%>
        <%--}--%>
      <%--}--%>
    <%--});--%>
    addValidateOldName($('#roleName'), "unique");
  });
</script>
<var id="roleIdFrom" style="display: none">${roleId}</var>
<div class="easyui-layout" data-options="fit:true,border:false">
  <div data-options="region:'center',border:false" title="" style="overflow: hidden;">
    <form id="form" method="post">
      <table class="table table-hover table-condensed">
        <tr>
          <th>编号</th>
          <td><input id="roleId" name="id" type="text" class="span2"  readonly="readonly" ></td>
        </tr>
        <tr>
          <th>角色名称</th>
          <td><input id="roleName" name="roleName" type="text" placeholder="请输入角色名称" class="easyui-validatebox span2"  data-options="required:true"></td>
        </tr>
        <tr>
          <th>角色说明</th>
          <td colspan="3"><textarea name="roleInfo" rows="" cols="" class="span5"></textarea></td>
        </tr>
      </table>
    </form>
  </div>
</div>